import { lazy } from "react";
import {createFromIconfontCN} from "@ant-design/icons"
const MyIcon = createFromIconfontCN({
    scriptUrl: '//at.alicdn.com/t/c/font_2402710_ffno0awfcu.js', // 在 iconfont.cn 上生成
});
// 设置懒加载路由
let Page404 = lazy(() => import("@/pages/Page404"))
let Login = lazy(() => import("@/pages/Login"))
// let Home = lazy(() => import("@/pages/Home"))
let PayManagement = lazy(() => import("@/pages/PayManagement"))
let PayType = lazy(() => import("@/pages/PayManagement/PayType"))
let PictureManagement = lazy(() => import("@/pages/PictureManagement"))
let CarsouelManagement=lazy(()=>import("@/pages/PictureManagement/CarsouelManagement"))
let ProductManagement = lazy(() => import("@/pages/ProductManagement"))
let ProductCategory = lazy(() => import("@/pages/ProductManagement/ProductCategory"))
let ProductList = lazy(() => import("@/pages/ProductManagement/ProductList"))
let TranscationManagement = lazy(() => import("@/pages/TranscationManagement"))
let Amiount = lazy(() => import("@/pages/TranscationManagement/Amiount"))
let Order = lazy(() => import("@/pages/TranscationManagement/Order"))
let Refund = lazy(() => import("@/pages/TranscationManagement/Refund"))
let LayoutContext=lazy(()=>import("@/layout/centent"))
// let LayoutPage=lazy(()=>import("@/layout"))
let routes: RouteObj[] = [
    {
        path: "/login",
        element: <Login />
    },
    // {
    //     path: '/home',
    //     element: <Home />
    // },
    {
        path: '*',
        element: <Page404 />
    },
    {
        path: '/',
        element: <LayoutContext />,
        children: [  
            {
                path: 'productmanagement',
                element: <ProductManagement />,
                label: '商品管理',
                key: 'productmanagement',
                icon: <MyIcon type="icon-shangpinguanli" />,
                children: [
                    {
                        path: 'productcategory',
                        element: <ProductCategory />,
                        label: '商品类目',
                        key: 'productcategory',
                        icon: <MyIcon type="icon-tubiaozhizuomoban" />,
                    },
                    {
                        path: 'productlist',
                        element: <ProductList />,
                        label: '商品列表',
                        key: 'productlist',
                        icon: <MyIcon type="icon-liebiao" />
                    }
                ]
            },
            {
                path: 'picturemanagement',
                element: <PictureManagement />,
                label: '图片管理',
                key: 'picturemanagement',
                icon: <MyIcon type="icon-tupian" />,
                children: [
                    {
                        path: 'carsouemanagement',
                        element: <CarsouelManagement />,
                        label: '轮播图管理',
                        key: 'carsouemanagement',
                        icon: <MyIcon type="icon-drxx70" />
                    }
                ]
            },
            {
                path: 'transcationmanagement',
                element: <TranscationManagement />,
                label: '订单管理',
                key: 'transcationmanagement', 
                icon: <MyIcon type="icon-biaoqiankuozhan_jiaoyi-195" />,
                children: [
                    {
                        path: 'amiount',
                        element: <Amiount />,
                        label: '总计',
                        key: 'amiount',
                        icon: <MyIcon type="icon-icon_A" />
                    },
                    {
                        path: 'order',
                        element: <Order />,
                        label: '订单中心',
                        key: 'order',
                        icon: <MyIcon type="icon-cangpeitubiao_dingdan" />
                    },
                    {
                        path: 'refund',
                        element: <Refund />,
                        label: '申请退款',
                        key: 'refund',
                        icon: <MyIcon type="icon-tuikuan" />
                    },
                ]
            },
            {
                path: 'paymanagement',
                element: <PayManagement />,
                label: '支付管理',
                key: 'paymanagement',
                icon: <MyIcon type="icon-ziyuan" />,
                children: [
                    {
                        path: 'paytype',
                        element: <PayType />,
                        label: '支付类型',
                        key: 'paytype',
                        icon:<MyIcon type = "icon-zhifu" />
                    }
                ]
            },
        ]
    }
]
export default routes